package kr.pe.xissy.soulmate.security;

import kr.pe.xissy.soulmate.service.UserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

public class SoulMateUserDetailsService implements UserDetailsService {

	@Autowired
	protected UserService userService;

	public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {
		try {
			return userService.findByEmail(username);

		} catch (UsernameNotFoundException e) {
			throw e;
		}
	}

}
